import request from '@/utils/request.js'

const prefix = "/api/teacher"

const contact = "/api/webContact"

const casePrefix = "/api/case"

// 获取讲师列表
export function list(params) {
	return request({
		url: prefix + '/teacherList',
		method: 'get',
		params: params
	})
}

//获取讲师详情
export function getTeacher(userId) {
	return request({
		url: prefix + `/getTeacher/${userId}`,
		method: 'get',
	})
}

/**
 * 更新讲师在线状态
 */
export function setOnline(userId,onlineStatus) {
	return request({
		url: `${prefix}/update/${userId}/${onlineStatus}`,
		method: 'post'
	})
}

/**
 * 讲师信息
 * @param {Object} id 讲师ID
 */
export function getInfo(id) {
	return request({
		url: prefix + `/getInfo/${id}`,
		method: 'get',
	})
}

//获取案例详情
export function getCase(id) {
    return request({
        url: casePrefix + `/get/${id}`,
        method: 'get',
    })
}


/**
 * 讲师信息
 */
export function getTeacherInfo(userId) {
	return request({
		url: prefix + `/getTeacherInfo/${userId}`,
		method: 'get',
	})
}



/**
 * 取消关注
 */
export function cancelInterest(teacherId) {
	return request({
		url: `${prefix}/delInterest/${teacherId}`,
		method: 'delete'
	})
}

/**
 * 关注
 */
export function addInterest(teacherId) {
	return request({
		url: `${prefix}/addInterest/${teacherId}`,
		method: 'post'
	})
}


/**
 * 线上课程
 */
export function onlineCourses(userId) {
	return request({
		url: `${prefix}/getCourse/${userId}`,
		method: 'get'
	})
}

export function mainCourse(userId) {
    return request({
        url: `${prefix}/getMainCourse/${userId}`,
        method: 'get',
    })
}


export function shortVideo(userId) {
    return request({
        url: `${prefix}/getShortVideo/${userId}`,
        method: 'get',
    })
}

/**
 * 资料下载
 */
export function profileData(userId) {
	return request({
		url: `${prefix}/getProfile?userId=${userId}`,
		method: 'get'
	})
}


/**
 * 案例
 */
export function caseData(userId) {
	return request({
		url: `${prefix}/getCase?userId=${userId}`,
		method: 'get'
	})
}

/**
 * @param {Object} id
 * 获取简历的下载地址
 */
export function getInfoUrl(userId) {
	return request({
		url: `${prefix}/getInfoDownloadUrl/${userId}`,
		method: 'get',
	})
}

/**
 * 预约讲师
 */
export function postContact(data) {
	return request({
		url: `${contact}/add`,
		method: 'post',
		data: data
	})
}